# Definition for a binary tree node.
class TreeNode:
    def __init__(self, x):
        self.val = x
        self.left = None
        self.right = None


class Solution:
    def sumOfLeftLeaves(self, root: TreeNode) -> int:
        def sumOfll(r, isLeft=False):
            if r is None:
                return 0
            if r.right is None and r.left is None and isLeft:
                return r.val
            return sumOfll(r.left, True) + sumOfll(r.right, False)

        return sumOfll(root, False)
